<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="format-detection" content="telephone=no" />
		<meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
		<script src="../../script/mui.min.js"></script>
		<script src="../../script/jquery.min.js"></script>
		<link rel="stylesheet" href="../../css/mui.min.css" />
		<link rel="stylesheet" href="../../css/swiper-3.4.2.min.css">
		<link rel="stylesheet" type="text/css" href="../../css/weui.min.css">
		<link rel="stylesheet" href="../../css/base.css"/>
		<link rel="stylesheet" href="../../css/personal.css">
		<link rel="stylesheet" href="../../css/exam.css">
		<title>技能章节考试页</title>
		<script type="text/javascript" charset="utf-8">
			mui.init();
		</script>
		<style>
			.weui_mask {
				position: fixed;
				z-index: 998;
				top: 0;
				right: 0;
				bottom: 0;
				left: 0;
			}
			.weui_dialog {
				z-index: 999;
			}
			.Empty_title  .mui-checkbox input[type=checkbox]:checked, .Empty_title .mui-radio input[type=radio]:checked {
				border: 1px solid #333;
				background: 0 0;
			}
			.Empty_title  .mui-checkbox input[type=checkbox]:checked:before, .Empty_title .mui-radio input[type=radio]:checked:before {
				color: #333;
			}
			.swiper-wrapper {
				min-height: 400px
			}
			.stu-test .mui-btn-primary {
				color: #fff;
				background-color: #FF9900;
				border: 1px solid #FF9900;
				padding-left: 2em;
				padding-right: 2em;
			}
			.questionItemImgDiv {
				height: 12em;
				width: 80%;
				max-height: 14em;
				max-width: 95%;
				margin-left: 13px;
			}
			.xuanzeImgDiv {
				width: 80%;
				height: 8em;
				max-height: 10em;
			}
			.tiankong {
				font-family: inherit;
				border-bottom: 1px solid #000;
				margin: 0 8px;
				text-align: center;
				width: auto;
				/*word-break:break-all*/
			}
			.question_video_div {
				padding: 10px 10px;
				padding-left: 20px;
			}
			.question_video_div	video {
				width: 100%;
				height: 13em;
				background-color: black;
			}
			.question_video_div	img {
				width: 100%;
				height: 10em;
				background-color: black;
			}
			.option_video_div {
				padding: 10px 10px;
				padding-left: 55px;
			}
			.option_video_div	img {
				width: 100%;
				height: 8em;
				background-color: black;
			}
			.option_video_div	video {
				width: 100%;
				height: 12em;
			}
			table {
				border: 1px solid #ccc;
				border-collapse: collapse;
				border-spacing: 0;
			}
			td, th {
				border: 1px solid #ccc;
				padding: 0;
				text-align: center
			}
			p {
				text-indent: 5px !important;
			}
		</style>
	</head>
	<body >
		<div class="stu-test" id="scroll">
			<div class="base_style_color" id='BarAppearance' style="height: 22px;width: 100%; position:fixed; left: 0px;top:0px;z-index: 998" ></div>
			<div class="base_navigation_bar base_style_color base_navigation_item_bar" style="position: fixed;left: 0px;top: 20px;">
				<div class="base_navigation_bar base_style_color base_navigation_item_bar">
					<a class="base_left_item" href="#" onclick="backClick()"> <img class="base_back_icon" src="../../image/icon_jiantou.png" alt=""> </a>
					<span id="title">章节练习</span>
				</div>
			</div>
			<div class="space10 " style="margin-top: 64px"></div>
			<div class="k-con-border qusetion-type " >
				<div class="k-con-part" style="position: static">
					<p class="k-text-center k-c323 k-f12">
						<span class="test-score-detail "> 试卷分数：<span class="k-cred" id="score"></span>分 </span>
						<span class="test-score-detail"> 通过分数：<span class="k-cred" id="passscore"></span>分 </span>
						<span class="test-score-detail"> 考试时间：<span class="k-cred" id="kstime"></span>分 </span>
					</p>
				</div>
			</div>
			<div class="k-con test-m-bottom70 test-analysis" id="question_div">
				<div class="swiper-container">
					<div class="swiper-wrapper" ></div>
				</div>
			</div>
			<div class="k-con1 k-text-center k-fixed-bottom test-bottom1" id="sub_div">
				<div class="k-con-part" id='score_bt' >
					<span class="test-score-detail"> 你的分数：<span class="k-cred" id="Testscore" ></span>分 </span>
					<div class="test_card_div" style="top: -10px">
						<a class="base_right_item "style="color: #18B4ED" href="#popover-card">答题卡 </a>
					</div>
				</div>
			</div>
			<div id="popover-card" class="mui-popover test-num-card" style=" width: 97%">
				<div class="mui-scroll-wrapper">
					<div class="mui-scroll" id="scroll-card"></div>
				</div>
			</div>
		</div>
		<div id="offlineAlert" class="weui_dialog_confirm" style="display: none;">
			<div class="weui_mask"></div>
			<div class="weui_dialog">
				<div class="weui_dialog_hd">
					<strong class="weui_dialog_title" id="checkNum"></strong>
				</div>
				<div class="weui_dialog_bd"></div>
				<div class="weui_dialog_ft">
					<a onclick="cleanCancel()" href="#" class="weui_btn_dialog default"  style="color:#18b4ed">取消</a>
					<a onclick="cleanConfirm()" href="#" class="weui_btn_dialog primary"  style="color:#18b4ed">确定</a>
				</div>
			</div>
		</div>
		<div class="weui_dialog_alert" id="closeAlert" style="display: none;">
			<div class="weui_mask"></div>
			<div class="weui_dialog">
				<div class="weui_dialog_hd">
					<strong class="weui_dialog_title" id="checkNum2"></strong>
				</div>
				<div class="weui_dialog_ft">
					<a onclick="Cancel()" href="#" class="weui_btn_dialog primary"  style="color:#18b4ed">确定</a>
				</div>
			</div>
		</div>
	</body>
	<script type="text/javascript" src="../../script/api.js"></script>
	<script src="../../script/jquery.min.js" type="text/javascript"></script>
	<script type="text/javascript" src="../../script/MD5.js"></script>
	<script src="../../script/common.js"></script>
	<script src="../../script/swiper-3.4.2.jquery.min.js" type="text/javascript"></script>
	<script type="text/javascript" src="../../script/requestTool.js"></script>
	<script type="text/javascript" src="../../script/certificationExam.js"></script>
	<script type="text/javascript" src="../../script/attachmentManager.js"></script>
	<script type="text/javascript">
		/*提交结果对象数组*/
		var json_jieguo = new Object();
		/*试卷题目个数*/
		var questionLen = '';
		apiready = function() {
			SendBehaviorTrajectoriesNotifi1('0', '技能课程章节练习结果页', '132', api.pageParam.sourceurl, api.pageParam.sourcetitle, window.location.pathname, document.title);
			//开启加载框
			showProgress();
			preData();
			scrollUI();
			// 滚动监听
			//获取数据
			loadData();
		}
		function preData() {
			var pageParam = api.pageParam;
			var h = api.winHeight * 0.3;
			$('#popover-card').css('height', h);
		}

		function backClick() {
			SendBehaviorTrajectoriesNotifi1('1', '技能课程章节练习结果页', '132', api.pageParam.sourceurl, api.pageParam.sourcetitle, window.location.pathname, document.title);
			api.closeWin();
		}

		//自由课程获取已提交测验信息
		function loadData() {
			var param = {
				uid : $api.getStorage('cfnetppuid'),
				quarter_id : api.pageParam.quarter_id,
				exam_id : api.pageParam.exam_id,
				type : "learn",
				cjid : api.pageParam.cjid,
			};
			cfnetppPOST(url_getstore, param, false, function(data, status) {
				hideProgress();
				if (status == 'success') {
					if (data.status == true) {
						var list = data.data;
						if (list != null) {
							$('#summary').text(list.ename);
							$('#score').text(list.zsorce);
							$('#passscore').text(list.efen);
							$('#kstime').text(list.dtime);
							$('#Testscore').text(list.chengji);
							json_jieguo = data.data.json_jieguo;
							if (list.shitiarr != null && list.shitiarr != '') {
								var dataArr = GetTestData(list.shitiarr);
								SetExamScoreUI(dataArr);
							} else {
								PopupHint2('题目为空');
							}
						} else {
							api.toast({
								msg : '获取测验题目数据失败',
								duration : 2000,
								location : 'bottom'
							});
						}
					} else {
						api.toast({
							msg : '获取测验题目数据失败',
							duration : 2000,
							location : 'bottom'
						});
					}
				} else {
					api.toast({
						msg : '获取测验题目数据失败',
						duration : 2000,
						location : 'bottom'
					});
				}
			});
		}

		function PopupHint2(str) {
			$("#checkNum2").text(str);
			$('#closeAlert').show();
		}

		function Cancel() {
			$('#closeAlert').hide();
			backClick();
		}

		function SetExamScoreUI(list) {
			var qxuan = '';
			var OrderNumStr = ""
			var questionStr = "";
			var qdaanStr = "";
			var xuanzeStr = "";
			var qdaanArr = "";
			var data = list;
			questionLen = data.length;
			//	生成答题卡题号
			TestScorePopoverCardNum(questionLen);
			for (var i = 0; i < questionLen; i++) {
				qxuan = JSON.parse(data[i].qxuanxiang);
				OrderNumStr = (i + 1) + '/' + questionLen + "." + "(" + judgeQuestionScore(data[i]) + "分)";
				questionStr = data[i].qtype != 11  ? questionsItemIsNull(data[i].questions) : FillInBlankQuestionStr(data[i]);
				if (json_jieguo[data[i].qid] == "" || json_jieguo[data[i].qid] == null || json_jieguo.hasOwnProperty(data[i].qid) == false) {//提交结果为空
					data[i]["Cjjieguo"] = ''
				} else {
					data[i]["Cjjieguo"] = json_jieguo[data[i].qid];
				}
				$(".swiper-wrapper").append('<div class="swiper-slide" id="item' + (i + 1) + '" itemtype="' + data[i].qtype + '"></div>')
				if (data[i].qtype == 1 || data[i].qtype == 3 || data[i].qtype == 8) {
					qdaanStr = judgeAnswerType(fromCharCode(data[i].Cjjieguo), judgeQuestiondaan(data[i]),  data[i].qtype, i);
					$("#item" + (i + 1)).append('<div class="k-con-part3 clearfix">' + '<span id="itemType" class="k-f18">' + CertificationQuestionTypeName(data[i].qtype) + '</span>' + '<p class="k-f16 k-c323 k-mt5 indent-5">' + OrderNumStr + questionStr + '</p>' + qdaanStr + '<div class="test-answer-list left_10"  itemtype="' + data[i].qtype + '">' + '</div>' + '</div>')
					//	是单选或判断
					for (var k = 0; k < qxuan.length; k++) {
						var xuanzeStr1 = data[i].qtype != 3 ? qxuan[k].xuanzhe : panxuanzeReturnStr(k);
						xuanzeStr = xuanzheImgIsNull(xuanzeStr1);
						if (data[i]["Cjjieguo"] != "") {
							if ((k + 1 ) != json_jieguo[data[i].qid]) {
								$("#item" + (i + 1) + " .test-answer-list").append('<div class="mui-input-row mui-radio mui-left " >' + xuanzeStr + '<input dataindex="' + (k + 1) + '"  onclick="return false;"   name="radio' + data[i].qid + '" type="radio"   itemid="' + data[i].qid + '">' + '</div> ')
							} else {
								$("#item" + (i + 1) + " .test-answer-list").append('<div class="mui-input-row mui-radio mui-left " >' + xuanzeStr + '<input dataindex="' + (k + 1) + '"  checked="checked"  onclick="return false;"   name="radio' + data[i].qid + '" type="radio"   itemid="' + data[i].qid + '" >' + '</div> ')
							}
						} else {
							$("#item" + (i + 1) + " .test-answer-list").append('<div class="mui-input-row mui-radio mui-left Empty_title" >' + '<label>' + xuanzeStr + '</label>' + '<input dataindex="' + (k + 1) + '"    onclick="return false;"   name="radio' + data[i].qid + '" type="radio"   itemid="' + data[i].qid + '"   >' + '</div> ')
						}
					}
				} else if (data[i].qtype == 2 || data[i].qtype == 9) {
					qdaanArr = strIsNullSpite(judgeQuestiondaan(data[i]));
					var keys1 = [];
					var userchooseLetter = [];
					if (data[i]["Cjjieguo"] = "") {
						keys1 = [];
						userchooseLetter = []
					} else {
						var jsonObject1 = JSON.parse(json_jieguo[data[i].qid]);
						for (var p1 in jsonObject1) {
							if (jsonObject1.hasOwnProperty(p1)) {
								keys1.push(p1);
							}
						}
						for (var j = 0; j < keys1.length; j++) {
							userchooseLetter.push(fromCharCode(keys1[j]))
						}
					}
					qdaanStr = judgeAnswerType(userchooseLetter.toString(), qdaanArr,  data[i].qtype, i);
					$("#item" + (i + 1)).append('<div class="k-con-part3 clearfix">' + '<span id="itemType" class="k-f18">' + CertificationQuestionTypeName(data[i].qtype) + '</span>' + '<p class="k-f16 k-c323 k-mt5 indent-5">' + OrderNumStr + questionStr + '</p>' + qdaanStr + '<div class="test-answer-list left_10"  itemtype="' + data[i].qtype + '">' + '</div>' + '</div>')
					//	是多选
					for (var k = 0; k < qxuan.length; k++) {
						xuanzeStr = xuanzheImgIsNull(qxuan[k].xuanzhe);
						if (keys1.toString().indexOf(k + 1) == -1) {
							$("#item" + (i + 1) + " .test-answer-list").append('<div class="mui-input-row mui-checkbox mui-left" >' + xuanzeStr + '<input dataindex="' + (k + 1) + '" name="checkbox1"  onclick="return false;"    value="Item 1" type="checkbox"  itemid="' + data[i].qid + '">' + '</div>')
						} else {
							$("#item" + (i + 1) + " .test-answer-list").append('<div class="mui-input-row mui-checkbox mui-left" >' + xuanzeStr + '<input dataindex="' + (k + 1) + '"  checked="checked"   onclick="return false;"  name="checkbox1" value="Item 1" type="checkbox"  itemid="' + data[i].qid + '">' + '</div>')
						}
					}
				} else if (data[i].qtype == 4 || data[i].qtype == 10||data[i].qtype == 12) {
					qdaanStr = judgeAnswerType(data[i].Cjjieguo, judgeQuestiondaan(data[i]), data[i].qtype, i);
					$("#item" + (i + 1)).append('<div class="k-con-part3 clearfix">' + '<span id="itemType" class="k-f18">' + CertificationQuestionTypeName(data[i].qtype) + '</span>' + '<p class="k-f16 k-c323 k-mt5 indent-5">' + OrderNumStr + questionStr + '</p>' + qdaanStr + '<div class="test-answer-list left_10"   >' + '</div>' + '</div>')
					// 论述
					$("#item" + (i + 1) + " .test-answer-list").append('<div class="test-answer-list">' + '<textarea  class="k-texttarea k-f14" readonly="readonly"    id="content" itemid="' + data[i].qid + '">' + isStringNull(data[i].cjjieguo) + '</textarea>' + '</div>')
				} else if (data[i].qtype == 7) {//识图题
					qdaanArr = strIsNullSpite(judgeQuestiondaan(data[i]));
					var keys1 = [];
					var userchooseLetter = [];
					if (data[i]["Cjjieguo"] = "") {
						keys1 = [];
						userchooseLetter = []
					} else {
						var jsonObject1 = JSON.parse(json_jieguo[data[i].qid]);
						for (var p1 in jsonObject1) {
							if (jsonObject1.hasOwnProperty(p1)) {
								keys1.push(p1);
							}
						}
						for (var j = 0; j < keys1.length; j++) {
							userchooseLetter.push(fromCharCode(keys1[j]))
						}
					}
					qdaanStr = judgeAnswerType(userchooseLetter.toString(), qdaanArr, data[i].qtype, i);
					$("#item" + (i + 1)).append('<div class="k-con-part3 clearfix">' + '<span id="itemType" class="k-f18">' + CertificationQuestionTypeName(data[i].qtype) + '</span>' + '<p class="k-f16 k-c323 k-mt5 indent-5">' + OrderNumStr + questionStr + '</p>' + qdaanStr + '<div class="test-answer-list left_10"  itemtype="' + data[i].qtype + '">' + '</div>' + '</div>')
					for (var k = 0; k < qxuan.length; k++) {
						xuanzeStr = xuanzheImgIsNull(qxuan[k].xuanzhe);
						for (var k = 0; k < qxuan.length; k++) {
							if (keys1.toString().indexOf(k + 1) == -1) {
								$("#item" + (i + 1) + " .test-answer-list").append('<div class="mui-input-row mui-checkbox mui-left" >' + xuanzeStr + '<input dataindex="' + (k + 1) + '" name="checkbox1"  onclick="return false;"    value="Item 1" type="checkbox"  itemid="' + data[i].qid + '">' + '</div>')
							} else {
								$("#item" + (i + 1) + " .test-answer-list").append('<div class="mui-input-row mui-checkbox mui-left" >' + xuanzeStr + '<input dataindex="' + (k + 1) + '"  checked="checked"   onclick="return false;"  name="checkbox1" value="Item 1" type="checkbox"  itemid="' + data[i].qid + '">' + '</div>')
							}
						}
					}
				} else if (data[i].qtype == 5) {//上传题
					$("#item" + (i + 1)).append('<div class="k-con-part3 clearfix">' + '<span id="itemType" class="k-f18">' + CertificationQuestionTypeName(data[i].qtype) + '</span>' + '<p class="k-f16 k-c323 k-mt5 indent-5">' + OrderNumStr + questionStr + '<p class="k-cred left_10">' + "移动端暂不支持上传题，请在PC端查看！" + '</p>' + '</p>' + '<div class="test-answer-list left_10"    onclick="return false;" itemtype="' + data[i].qtype + '">' + '</div>' + '</div>')
				} else if (data[i].qtype == 11) {
					var user_answer = data[i].user_answer.split('|');
					qdaanStr = JudgeQuestionCorrectMessage(data[i], e_display_da, data[i].qtype, i);
					$("#item" + (i + 1)).append('<div class="k-con-part3 clearfix">' + '<span id="itemType" class="k-f18">' + CertificationQuestionTypeName(data[i].qtype) + '</span>' + '<p class="k-f16 k-c323 k-mt5 indent-5">' + scoreStr + questionStr + '</p>' + qdaanStr + '<div class="test-answer-list left_10" >' + '</div>' + '</div>');
					$.each(user_answer, function(k, e) {
						$("#item" + (i + 1)).find('.tiankong:eq(' + k + ')').attr("value", e)
						$("#item" + (i + 1)).find('.tiankong:eq(' + k + ')').attr("readonly", "readonly");
					});
				}
			}
			//  试题总数
			// 点击答题卡切换
			var mySwiper = new Swiper('.swiper-container', {
				autoHeight : true,
				autoplayDisableOnInteraction : false,
				direction : 'horizontal',
				loop : false,
			})
			// 点击答题卡切换
			$("#popover-card span").on("click", function() {
				var index = $(this).index();
				mySwiper.slideTo(index, 1000, false);
				mui('#popover-card').popover('hide')
			});
		}

		function judgeAnswerType(CjjieguoStr, qdaan, type,i) {
			var AnswerStr = "";
			var INFOStr = "";
			if (type == 4 || type == 10 ) {
				INFOStr = "解析是"
			} else {
				INFOStr = "正确答案是"
			}
			/*是否显示正确答案*/
			if (!isEmpty(qdaan)) {
				AnswerStr = ", "+INFOStr+":" + questionsItemIsNull(HTMLDecode(qdaan));
			} else {
				AnswerStr = "";
			}
			if (CjjieguoStr == '') {//提交结果为空
				$("#scroll-card").find("span").eq(i).removeClass('qusetion-num-selected').addClass('qusetion-num-normal');
				return '<p class="k-cred">' + "您未答题" + AnswerStr + '</p>'
			} else {
				if (CjjieguoStr == qdaan) {//答案正确
					$("#scroll-card").find("span").eq(i).removeClass('qusetion-num-selected').addClass('qusetion-num-true');
					return '<p class="k-cred">' + "恭喜您答对了" + AnswerStr + '</p>'
				} else {
					$("#scroll-card").find("span").eq(i).removeClass('qusetion-num-selected').addClass('qusetion-num-false');
					return '<p class="k-cred">' + "您答错了" + AnswerStr + '</p>'
				}
			}
		}
	</script>
</html>